package com.java.day04.arr;

import java.util.Scanner;

/**
 * 创建一个Scanner类型的数组
 */
public class Demo01 {

    public static void main(String[] args) {
       //初始化创建一个Scanner类型的数组,长度为5
        Scanner[] scannerArr = new Scanner[5];

        //每个数组元素都是一个scanner对象
        scannerArr[0]=new Scanner(System.in);
        scannerArr[1]=new Scanner(System.in);
        scannerArr[2]=new Scanner(System.in);

        System.out.println("请输入姓名:");
        String line = scannerArr[0].nextLine();

        System.out.println(line);



        //静态初始化
        Scanner[] scanners = {new Scanner(System.in),new Scanner(System.in),new Scanner(System.in)};

        System.out.println("请输入年龄:");
        int s = scanners[0].nextInt();

        System.out.println(s);


    }
}
